	<title>设置权限</title>
	<style>
		a{ color:green!important; }
	</style>
	<link rel="stylesheet" type="text/css" href="__STATIC__/js/layui256/layui/css/layui.css">
</head>
<body>
	<div class="layui-tab">
		<div class="layui-col-md12">
			<div id="set-rbac-tree"></div>
		</div>
	</div>
<script src="__STATIC__/js/jquery.js"></script>
<script src="__STATIC__/js/layui256/layui/layui.all.js"></script>
<script src="__STATIC__/js/layer/layer.js"></script>
<script>
var data = {$list};
var tree = null;
var layer = null;
layui.use( [ 'tree' , 'layer' ] , function(){
	tree = layui.tree,
	layer = layui.layer;
	var indexTree = tree.render({
		elem: "#set-rbac-tree",
		data:data,
		id:'set-rbac-tree',
		showLine:false,
		showCheckbox: false,
		onlyIconControl:false,
	});
} );

var saveModule = function( index, cid){
	var list =[];
	$(document).find( '.radio-version' ).each(function(){
		let select = $(this).is( ':checked' );
		let value = $(this).val();
		if( select && value != ''  ){
			list.push( value );
		}
	});
	if( list.length == 0 ){
		parent.layer.msg( '请至少选择一项' , function(){} );
		return false;
	}
	$.post( '{:url("authorization/RbacModule/selectModule")}?cid='+cid , { list:list } , function( res ){
		parent.layer.msg( res.message , { icon : (res.code == 200 ) ? 1: 2 , time:800  } , function(){
			if( res.code == 200 ){
				parent.layer.close(index);
				parent.location.reload();
			}
		} );
	});
}

</script>
</body>
</html>